package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class HomeWorkEasyNote
{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please input your note name : (such as 1.txt)");
        String name = scanner.nextLine();   // next 和 nextLine 的区别为 一个以空格为区分，一个以回车为区分
        FileOutputStream fos = new FileOutputStream(name,true);   // 追加 而不是 覆写
        System.out.println("please input your record");
        String line = scanner.nextLine();
        while (!"exit".equals(line))
        {
            fos.write(line.getBytes(StandardCharsets.UTF_8));
            line = scanner.nextLine();
        }
        fos.close();

    }

}
